#ifndef _MATERIAL_H_
#define _MATERIAL_H_

#ifdef _WIN32
#pragma once
#endif

/**
 * A class to create, edit and set materials.
 *
 * 24/02/2012 - Stephen Gore - Created the class structure, implemented from 
 *                             UML with all the get and set functions for all 
 *                             all the attributes of the D3DMATIAL9 class.
 *
 * 25/02/2012 - Stephen Gore - Defined all original functions. 
 *                           - Commented all functions.
 *                           - Made all functions and parameters that need to 
 *                             be are constant
 */

#include <d3dx9.h>

class CMaterial 
{
public:
    // Constructor.
    CMaterial();
    CMaterial(const D3DMATERIAL9 &material);

    // Diffuse color.
    void setDiffuse(const D3DCOLORVALUE &color);
    void setDiffuse(float r, float g, float b, float a);
    void getDiffuse(float &r, float &g, float &b, float &a) const;
    D3DCOLORVALUE getDiffuse() const;
    
    // Ambient color.
    void setAmbient(const D3DCOLORVALUE &color);
    void setAmbient(float r, float g, float b, float a);
    void getAmbient(float &r, float &g, float &b, float &a) const;
    D3DCOLORVALUE getAmbient() const;
    
    // Specular color.
    void setSpecular(const D3DCOLORVALUE &color);
    void setSpecular(float r, float g, float b, float a);
    void getSpecular(float &r, float &g, float &b, float &a) const;
    D3DCOLORVALUE getSpecular() const;

    // Emissive color.
    void setEmissive(const D3DCOLORVALUE &color);
    void setEmissive(float r, float g, float b, float a);
    void getEmissive(float &r, float &g, float &b, float &a) const;
    D3DCOLORVALUE getSEmissive() const;

    // Power.
    void setPower(float power);
    float getPower();

    // Apply material to given device. 
    void applyMaterial(LPDIRECT3DDEVICE9 p_Device) const;
private:
    // The material.
    D3DMATERIAL9 m_Material;
};

#endif